package com.bw.day03.adapter

import android.widget.Button
import com.bw.base.net.entity.My
import com.bw.base.net.entity.MyQuanEntity
import com.bw.day03.R
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.ta.utdid2.a.a.h
import java.text.SimpleDateFormat

class MyUnQuanAdapter: BaseQuickAdapter<My, BaseViewHolder>(R.layout.item_mynoquan) {
    override fun convert(
        holder: BaseViewHolder,
        item: My
    ) {
        holder.setText(R.id.name,item.name)
        holder.setText(R.id.money,item.money)
        holder.setText(R.id.time,item.endTime)
        val simpleDateFormat = SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
        val format = simpleDateFormat.format(System.currentTimeMillis())
        if (format<item.endTime){
            val view = holder.getView<Button>(R.id.btn)
            view.text = "未使用"
        }else{
            val view = holder.getView<Button>(R.id.btn)
            view.text = "已过期"
        }

    }
}